#include <cppunit/config/SourcePrefix.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/TestFactoryRegistry.h>

#include "Parser_ASTTest.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include <stdio.h>

using namespace std;

void
Parser_ASTTest::setUp()
{}
void
Parser_ASTTest::tearDown()
{}

CPPUNIT_TEST_SUITE_REGISTRATION( Parser_ASTTest );


void Parser_ASTTest::testParser_AST(){
	cout << "Testing : Parser to AST" << endl;	
	//parse the SIMPLE source code into the parser
	PKB* pkb = new PKB();
	Parser* p = new Parser(pkb);
	
	p->startParsing("../Release/src.txt"); 

	stringstream ss;
	
	/*// verify that parentTable is correct
	for (auto it = pkb->ast->parentTable.begin(); it != pkb->ast->parentTable.end(); ++it) {
		 ss << it->first << " : " << it->second << endl;
	}
	CPPUNIT_ASSERT("2 : 3\n2 : 5\n3 : 4\n"==ss.str());
	ss.clear();
	ss.str(" ");

	// verify that followsTable is correct
	for (auto it = pkb->ast->followsTable.begin(); it != pkb->ast->followsTable.end(); ++it) {
		ss << it->first << " : " << it->second << endl;
	}
	CPPUNIT_ASSERT("1 : 2\n3 : 5\n2 : 6\n"==ss.str());
	ss.clear();
	ss.str(" ");
	*/
	cout << "Test OK: Parser to AST" << endl;
};
